<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .red {
      width: 50px;
      height: 50px;
      background-color: red;
    }





    .yellow {
      width: 50px;
      height: 50px;
      background-color: yellow;
    }



    div {
      display: inline-block;

    }
  </style>
</head>

<body>

  <script>
    for (let row = 1; row <= 8; row++) {

      if (row % 2) {
        document.write(`<div class="red "></div>`);

      }

      for (let col = 1; col <= 8; col++) {
        if (col % 2) {
          document.write(`<div class="yellow"></div>`);

        } else {
          document.write(`<div class="red"></div>`);

        }
      }
      document.write(`<br>`)


    }


  </script>

</body>

</html>